package com.biscuit.page.basicservice.websocket;

import lombok.Getter;

import java.util.Arrays;

/**
 * @author biscuit
 * @createTime 2024/6/14 17:03
 */
@Getter
public enum MessageCallbackTypeEnum {

    INIT_SUCCESS(1, "初始化完成"),
    NEW_MESSAGE_INFORM(2, "新信息通知"),
    REFRESH_ONLINE_LIST(3, "刷新在线用户列表");

    private final int type;

    private final String described;

    MessageCallbackTypeEnum(int type, String described) {
        this.type = type;
        this.described = described;
    }

    public static MessageCallbackTypeEnum getEnumByType(int type) {
        return Arrays.stream(MessageCallbackTypeEnum.values()).filter(x -> x.getType() == type).findFirst().orElse(null);
    }

}
